import React from 'react';
import { useNavigate } from 'react-router-dom';
import styles from './welcome.module.css';

const Welcome = ({ onEnterHome }) => {
  const navigate = useNavigate();

  const handleEnterHome = () => {
    onEnterHome ? onEnterHome() : navigate('/home', { replace: true });
  };

  return (
    <div className={styles.container}>
      <div className={styles.card}>
        <div className={styles.decorLine}></div>
        <div className={styles.bgDecor1}></div>
        <div className={styles.bgDecor2}></div>
        <h1 className={styles.title}>
          welcome
        </h1>
        <p className={styles.subtitle}>
          高效、简洁的解决方案，为您提供优质体验
        </p>
        <button
          className={styles.enterBtn}
          onClick={handleEnterHome}
          aria-label="点击进入主页"
        >
          进入主页
        </button>
        <div className={styles.versionText}>
          版本 1.0.0 · 版权所有 © 2025 by Raven Kane
        </div>
      </div>
    </div>
  );
};

export default Welcome;